import { DataTypes } from 'sequelize';
import { Migration } from '../umzug';

/**
 * 填写问卷的用户
 * @param param0 表名users
 */
export const up: Migration = async ({ context: sequelize }) => {
  await sequelize.getQueryInterface().createTable('users', {
    id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: DataTypes.STRING(36), unique: true },
    name: { type: DataTypes.STRING(255) },
    num: { type: DataTypes.STRING(255) },
    tel: { type: DataTypes.STRING(11) },
    gender: { type: DataTypes.INTEGER },
    complate_flag: { type: DataTypes.INTEGER },
    marital_status: { type: DataTypes.INTEGER },
    /** 子女状况*/
    children_situation: { type: DataTypes.INTEGER },
    age: { type: DataTypes.INTEGER },
    /** 文化程度*/
    education: { type: DataTypes.INTEGER },
    /** 工作单位*/
    work_unit: { type: DataTypes.STRING(255) },
    /** 附属单位 */
    affiliated: { type: DataTypes.STRING(255) },
    /** 工作职位 */
    job_position: { type: DataTypes.STRING(255) },
    /** 工作岗位*/
    operating_post: { type: DataTypes.STRING(255) },
    created_at: { type: DataTypes.DATE },
    updated_at: { type: DataTypes.DATE },
  });
};

export const down: Migration = async ({ context: sequelize }) => {
  await sequelize.getQueryInterface().dropTable('users');
};
